package collection;


import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * 测试collection接口中的方法
 */
public class TestList {
    public static void main(String[] args) {
        test02();
    }

    public static void test01(){
        Collection<String> c = new ArrayList<>();
        c.size();
        c.add("张哲");
        System.out.println(c);
    }

    //ArrayList索引和顺序相关
    public static void test02() {
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        list.add("d");
        System.out.println(list);
        list.add(2,"z张哲");
        System.out.println(list);
    }

}
